<template>
  <div class="my-swiper">
    <swiper ref="mySwiper" :options="swiperOptions">
      <swiper-slide v-for="(item,index) in swiperList" :key="index">
        <img :src="item.img" alt="" />
      </swiper-slide>
    </swiper>
  </div>
</template>

<script>
import Vue from "vue";
import VueAwesomeSwiper from "vue-awesome-swiper";
import "swiper/swiper-bundle.css";
Vue.use(VueAwesomeSwiper);

import api from "../../api";
export default {
  name: "MySwiper",
  data() {
    return {
      swiperOptions: {
        loop: true,
      },
      swiperList: [],
    };
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper;
    },
  },
  mounted() {
    this.swiper.slideTo(3, 1000, false)
    api.swiperimg().then((res) => {
      // console.log(res.data);
      this.swiperList = res.data.list;
      console.log(this.swiperList);
    });
  },
};
</script>

<style scoped>
.my-swiper img {
  width: 100%;
  height: 100%;
}
</style>